package com.hmall.user.config;

import com.hmall.user.interceptor.AuthorizationInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auth：Yang Zhen
 * @Desc：注册 user-service 服务的拦截器
 * @Date：2023/4/20 9:08
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 拦截 经过 user-service 服务的所有请求 "/**" 代表所有路径
        registry.addInterceptor(new AuthorizationInterceptor()).addPathPatterns("/**")
                .excludePathPatterns("/user/seleceByUsername/**");
    }

}
